<script setup>
  import { onMounted, ref, reactive, computed } from 'vue'
  import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
  import { http } from '@/utils/http.js'
  import { parseTime } from '@/utils/index.js'
  import Api from './api/index.js'
  const __Api = new Api()
  import { useUsercodeStore } from '@/store/usercode.js'
  import dayjs from 'dayjs'
  const goodsDatas = ref([])
  const point = ref([])
  const goodImg = ref('')
  const gameStart = ref(false)
  const gameObj = ref(null)
  //
  const switchNum = ref(0)
  let switchTimer = null
  const gamingNum = ref(0)
  let gamingTimer = null
  const gameStatus = ref(0) //0 为开始 1已开始  2已结束

  function switchFun() {
    switchTimer = setInterval(() => {
      switchNum.value = (switchNum.value - 1).toFixed(0)
      if (switchNum.value < 1) {
        clearInterval(switchTimer)
        gameStatus.value = -1 //结束
        uni.utils.toast('通道关闭游戏结束')
      }
    }, 1000)
  }
  function gamingFun() {
    gamingTimer = setInterval(() => {
      gamingNum.value = (gamingNum.value - 1).toFixed(0)
      if (gamingNum.value < 1) {
        uni.utils.toast('时间到啦，下次再来吧～')
        clearInterval(gamingTimer)
        clearInterval(ropetimer)
        gameStatus.value = -1 //结束
        __Api.gameEnd({ game_id: game_id.value }).then((res) => {})
      }
    }, 1000)
  }
  //
  let rotatetimer = null
  const rotateNum = ref(0)
  const rotateState = ref(true)
  function rotateFun() {
    // console.log('2222222')
    clearInterval(ropetimer)
    ropeState.value = true
    ropeNum.value = 0
    gameStart.value = false
    rotatetimer = setInterval(() => {
      if (rotateState.value) {
        rotateNum.value = rotateNum.value + 3
        // rotateNum.value = 50
      } else {
        rotateNum.value = rotateNum.value - 3
        // rotateNum.value = 50
      }
      if (Math.abs(rotateNum.value) == 60) {
        rotateState.value = !rotateState.value
      }
    }, 50) // 每秒增加角度的值
  }
  let ropetimer = null
  const ropeNum = ref(0)
  const ropeState = ref(true) /// 控制出钩收钩
  function gameStartFun() {
    if (!gameStart.value && gameStatus.value == 0) {
      __Api.gameStart({ game_id: game_id.value }).then((res) => {
        if (res.st == 1) {
          gameStart.value = true
          gameStatus.value = 1
          clearInterval(switchTimer)
          gamingFun()
          ropeFun()
        } else {
          uni.utils.toast(res.msg)
        }
      })
    } else if (!gameStart.value && gameStatus.value == 1) {
      gameStart.value = true
      gameStatus.value = 1
      ropeFun()
    } else if (gameStatus.value != 1 || !gameStatus.value != 0) {
      uni.utils.toast('游戏已结束')
    }
  }
  const VObj = {
    1: 4,
    2: 3,
    3: 2,
  }

  function ropeFun() {
    //开始游戏
    if (ropeState.value) {
      clearInterval(rotatetimer)
      ropetimer = setInterval(() => {
        if (ropeState.value) {
          ropeNum.value = ropeNum.value + VObj[1]
          getGoodFun()
        } else {
          let vnum = VObj[1]
          if (getBoxIndex.value != '') {
            const level = goodsDatas.value[getBoxIndex.value].level
            vnum = VObj[level]
          }
          ropeNum.value = ropeNum.value - vnum
          getGoodFun()
        }
      }, 40) // 每秒增加绳子的值
    }
  }

  function returnPos(item, width) {
    return `left:${item[0]}rpx;top:${item[1]}rpx;width:${width}rpx;height:${width}rpx;`
  }
  function getGoodFun() {
    let rotate = rotateNum.value
    let rope = ropeNum.value
    let Cl = rotate * (Math.PI / 180)
    let cl = Math.abs(rotate) * (Math.PI / 180)
    let clipPoints = []
    const mathX = Math.abs(Math.sin(Cl) * (rope + 80)) // 左侧点X轴偏移值
    const mathY = Math.abs(Math.cos(Cl) * (rope + 80)) // 左侧点Y轴偏移值
    const mathx = Math.abs(Math.cos(cl) * 10) // 右侧点Y轴偏移值
    const mathy = Math.abs(Math.sin(cl) * mathx) // 右侧点X轴偏移值
    if (rotate > 0) {
      // 左侧
      clipPoints[0] = [375 - mathX - mathx, mathY - 80 - mathy]
      clipPoints[1] = [375 - mathX + mathx, mathY - 80 + mathy]
    } else {
      // 右侧
      clipPoints[0] = [375 + mathX - mathx, mathY - 80 + mathy]
      clipPoints[1] = [375 + mathX + mathx, mathY - 80 - mathy]
    }

    if (
      clipPoints[0][0] < 0 ||
      clipPoints[0][0] > 750 ||
      clipPoints[0][1] > 700
    ) {
      ropeState.value = false
    }
    // console.log(
    //   '捕获目标后回收.value',
    //   getBoxIndex.value,
    //   getBoxIndex.value != ''
    // )
    if (getBoxIndex.value + '' != '') {
      //
      goodsDatas.value[getBoxIndex.value]['movePoint'] = clipPoints
      goodsDatas.value[getBoxIndex.value]['move'] = true
      // console.log(clipPoints[0][1], ropeState.value)
      if (ropeNum.value < 1 && !ropeState.value) {
        ropeState.value = true
        __Api
          .gameSub({
            game_id: game_id.value,
            level: goodsDatas.value[getBoxIndex.value].level,
          })
          .then((ress) => {
            if (ress.st == '') {
              goodImg.value = ress.data.goods_img
              clearInterval(ropetimer)
              // 提交成功

              goodsDatas.value[getBoxIndex.value]['show'] = false
              getBoxIndex.value = ''
              rotateFun()
            } else {
              clearInterval(ropetimer)
              // uni.utils.toast('游戏已结束')
            }
          })
      }
      // if (ropeNum.value < 1 && !ropeState.value) {
      //   ropeState.value = true
      //   clearInterval(ropetimer)
      //   // 提交成功

      //   goodsDatas.value[getBoxIndex.value]['show'] = false
      //   getBoxIndex.value = ''
      //   rotateFun()
      // }

      // console.log(goodsDatas.value[getBoxIndex.value]['movePoint'])
    } else {
      if (clipPoints[0][1] < 1 && !ropeState.value) {
        console.log('getBoxIndex.value')
        getBoxIndex.value = ''
        rotateFun()
      }
    }
    point.value = clipPoints
    // 设置捕获目标位置
    let i = 0
    goodsDatas.value.map((res) => {
      // 判断点是否在方块内
      if (res.show) {
        if (
          uni.utils.isPointInPolygon(clipPoints[0], res.points) ||
          uni.utils.isPointInPolygon(clipPoints[1], res.points)
        ) {
          ropeState.value = false
          // console.log(i, '111111')
          getBoxIndex.value = i
          console.log('捕获', i)
          // 捕获
          return false
        } else {
          i++
        }
      } else {
        i++
      }
    })
  }
  const getBoxIndex = ref('')

  const rulepopup = ref('')
  const ruleStrings = ref('')
  async function toRule() {
    __Api
      .getRuleDetails({
        id: 11,
      })
      .then((res) => {
        rulepopup.value.open('center')
        ruleStrings.value = res.data.details
      })
    // uni.navigateTo({
    //   url: `/drawPage/goldDraw/rule`,
    // })
  }
  function closeRule() {
    rulepopup.value.close('')
  }
  const isAll = ref(false)
  const logspopup = ref('')
  const page = ref(1)
  const getgoodsList = ref([])
  function scrolltolower() {
    page.value++
    __Api
      .drawlist({ box_id: box_id.value, page: page.value, is_own: 1 })
      .then((res) => {
        getgoodsList.value = getgoodsList.value.concat(res.data)
      })
  }
  function changeState(item) {
    getgoodsList.value = []
    isAll.value = item
    page.value = 1
    logInit()
  }
  const userInfo = ref()
  function openLogs() {
    const userCodeStore = useUsercodeStore()
    userInfo.value = userCodeStore.usercode
    logInit()
    logspopup.value.open('center')
  }
  function logInit() {
    __Api
      .drawlist({
        box_id: box_id.value,
        page: page.value,
        is_own: isAll.value ? null : 1,
      })
      .then((res) => {
        getgoodsList.value = getgoodsList.value.concat(res.data)
      })
  }
  function closeLogs() {
    logspopup.value.close('')
  }
  function toLogs() {
    clearInterval(ropetimer)
    clearInterval(rotatetimer)
    clearInterval(switchTimer)
    clearInterval(gamingTimer)
    uni.navigateTo({
      url: `/drawPage/goldDraw/logs?box_id=${box_id.value}`,
    })
  }
  function goBack() {
    // console.log(1)
    uni.navigateBack()
    // let pages = getCurrentPages()
    // uni.navigateBack({
    //   delta: 1,
    //   success() {
    //     //pages.length-1 即最后一个为当前页，所以取当前页面的上一级
    //     uni.$emit('refresh', {
    //       gameStatus: gameStatus.value,
    //       switchNum: switchNum.value,
    //       gamingNum: gamingNum.value,
    //     })
    //   },
    // })
  }
  const game_id = ref('')
  const box_id = ref('')

  function init() {
    __Api.gameDetail({ game_id: game_id.value }).then((res) => {
      gameObj.value = res.st
      const Obj = res.st
      const arr1 = []
      const arr2 = []
      const arr3 = []
      gameStatus.value = Obj.status

      switchNum.value = Obj.in_seconds_cutdown
      gamingNum.value = Obj.game_seconds_cutdown
      if (Obj.status == 0) {
        // 未开始
        switchFun()
      }
      if (Obj.status == 1) {
        // 进行中
        gamingFun()
      }
      for (let i = 0; i < +Obj.minedetail.num1; i++) {
        arr1.push({ level: 1, movePoint: [], move: false, show: true })
      }
      for (let i = 0; i < +Obj.minedetail.num2; i++) {
        arr2.push({ level: 2, movePoint: [], move: false, show: true })
      }
      for (let i = 0; i < +Obj.minedetail.num3; i++) {
        arr3.push({ level: 3, movePoint: [], move: false, show: true })
      }
      const DataA = uni.utils.SetPoint(arr1, 1)
      const DataB = uni.utils.SetPoint(arr2, 2)
      const DataC = uni.utils.SetPoint(arr3, 3)
      goodsDatas.value = [...DataA, ...DataB, ...DataC]
      // console.log(111)
      rotateFun()
    })
  }
  onLoad((options) => {
    game_id.value = options.game_id
    box_id.value = options.box_id
    ropeNum.value = 0
    rotateNum.value = 0
    point.value = []
    getBoxIndex.value = ''
    gameStart.value = false
    clearInterval(ropetimer)
    clearInterval(rotatetimer)
    clearInterval(switchTimer)
    clearInterval(gamingTimer)
    init()
  })

  onShow(() => {})
  onUnload(() => {
    // console.log('coloseee')
    clearInterval(ropetimer)
    clearInterval(rotatetimer)
    clearInterval(switchTimer)
    clearInterval(gamingTimer)
  })
</script>

<template>
  <view class="warp">
    <view class="war-top">
      <view class="war-back" @click="goBack">
        <view class="back-aim"> </view>
      </view>
    </view>
    <view class="top_box">
      <image
        class="topBg"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/top-bg.jpg"
        mode="widthFix"
      ></image>
      <!-- 背包 -->
      <image
        @click="openLogs()"
        class="gift-box"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/gift-box.png"
        mode="widthFix"
      ></image>
      <!-- 记录 -->
      <!--  <image
        @click="toLogs()"
        class="logs_btn"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/logs.png"
        mode="widthFix"
      ></image> -->
      <!-- 规则 -->
      <image
        @click="toRule()"
        class="rule_btn"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/rule.png"
        mode="widthFix"
      ></image>
    </view>
    <view class="content">
      <image
        style="top: -240rpx"
        class="npc"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/npc.png?1"
        mode="widthFix"
      ></image>
      <view
        class="moveBox"
        style="top: -70rpx"
        :style="'transform:rotate(' + rotateNum + 'deg)'"
      >
        <view
          class="rope"
          style="top: -80rpx"
          :style="'height:' + ropeNum + 'rpx'"
        >
        </view>
        <image
          style="width: 80rpx; height: 80rpx"
          class="clip"
          src="https://ojqn.wm2177.com/wechat_imgs/gold/clip.png"
        ></image>
      </view>
      <view class="goldsBox" v-if="goodsDatas.length">
        <!--  <view
          v-if="point.length"
          class="clipsPoints"
          :style="`left:${point[0][0]}rpx;top:${point[0][1]}rpx`"
        >
        </view>
        <view
          v-if="point.length"
          class="clipsPoints"
          :style="`left:${point[1][0]}rpx;top:${point[1][1]}rpx`"
        >
        </view> -->
        <view class="timeBox">
          <view class="switchBox">
            <span v-if="gameStatus == 0">{{ switchNum }}秒后失去机会</span>
            <span v-else-if="gameStatus == 1">进行中</span>
            <span v-else>已结束</span>
          </view>
          <view class="gamingBox">
            <span v-if="gameStatus == 0">请尽快开始</span>
            <span v-else-if="gameStatus == 1">{{ gamingNum }}秒后结束</span>
            <span v-else>已结束</span>
          </view>
        </view>
        <!-- goodImg -->
        <image
          :src="`${
            item.show
              ? `https://ojqn.wm2177.com/wechat_imgs/gold/gold${item.level}.gif`
              : goodImg
          }`"
          mode="widthFix"
          class="goldItem"
          v-for="(item, index) in goodsDatas"
          :key="index"
          :class="{ hide: item.show ? false : true }"
          :style="`${returnPos(
            item.move ? item.movePoint[0] : item.points[0],
            item.width
          )}`"
        >
        </image>
      </view>
      <image
        style="width: 100%; height: 1250rpx"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/bottom-bg.png"
      ></image>
    </view>
    <image
      @click="gameStartFun()"
      class="begin_btn"
      src="https://ojqn.wm2177.com/wechat_imgs/gold/begin-btn.png"
      mode=""
    ></image>
  </view>
  <!-- 出奖记录弹出层 -->
  <uni-popup ref="logspopup" type="bottom" class="logspopup">
    <view class="top_box">
      <view class="select_box">
        <image
          @click="changeState(false)"
          :src="`https://ojqn.wm2177.com/wechat_imgs/gold/my-logss${
            !isAll ? '-select' : ''
          }.png`"
          mode="widthFix"
        ></image>
        <image
          @click="changeState(true)"
          :src="`https://ojqn.wm2177.com/wechat_imgs/gold/logs${
            isAll ? '-select' : ''
          }.png`"
          mode="widthFix"
        ></image>
      </view>
      <scroll-view
        class="scrollBox"
        scroll-y="true"
        :lower-threshold="20"
        @scrolltolower="scrolltolower"
      >
        <view
          class="listItem"
          v-for="(item, index) in getgoodsList"
          :key="index"
        >
          <view class="leftBox">
            <image
              class="icon"
              :src="isAll ? item.himg : userInfo.himg"
              mode="widthFix"
            ></image>
            <view class="" style="margin-left: 20rpx">
              <view class="name">
                {{ isAll ? item.nickname : userInfo.nickname }}
              </view>
              <view class="time"> {{ item.createtime }} </view>
            </view>
          </view>
          <image
            style="width: 100rpx"
            :src="item.goods_img"
            mode="widthFix"
          ></image>
        </view>
      </scroll-view>
      <!-- 背包 -->
    </view>
    <view class="content">
      <image
        style="width: 100%"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/bottom-bg.png"
        mode="widthFix"
      ></image>
      <!-- transform: rotate(30deg); -->
    </view>
    <!-- <view class="logspopup-content">
      <scroll-view
        class="scroll_goods"
        scroll-x="true"
        :lower-threshold="120"
        @scrolltolower="scrolltolower"
      >
        
        <view
          class="goodsItem"
          v-for="(item, index) in getgoodsList"
          :key="index"
        >
          <image :src="item.goods_img" mode="widthFix"></image>
          <view class="timetxt">
            {{ parseTime(item.createtime) }}
          </view>
        </view>
      </scroll-view>
      <image
        @click="closeLogs()"
        class="sure"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/ok-btn.png"
        mode=""
      ></image>
      <view class="bottomTxt"> 奖品已经放入背包 </view>
    </view> -->
  </uni-popup>
  <!-- 规则弹出层 -->
  <uni-popup ref="rulepopup" type="bottom">
    <view class="rulepopup-content">
      <view class="ruleTxt" style=""> 玩法规则 </view>
      <view style="padding: 0 20rpx" class="" v-html="ruleStrings"> </view>
      <image
        @click="closeRule"
        src="https://ojqn.wm2177.com/wechat_imgs/gold/popup-close.png"
        mode=""
      ></image>
    </view>
  </uni-popup>
</template>
<style lang="less" scoped>
  .logspopup {
    width: 600rpx;
    .top_box {
      position: relative;
      .scrollBox {
        width: 100%;
        height: 620rpx;
        position: absolute;
        z-index: 1;
        top: 120rpx;
        display: flex;
        justify-content: center;
        .listItem {
          margin: 0 auto;
          width: 560rpx;
          height: 140rpx;
          display: flex;
          align-items: center;
          justify-content: space-between;
          background-image: url('https://ojqn.wm2177.com/wechat_imgs/gold/user-bg.png');
          background-size: 100%;
          padding: 20rpx 60rpx;
          box-sizing: border-box;
          margin-bottom: 20rpx;
          .leftBox {
            display: flex;
            align-items: center;
            color: #462917;
            font-size: 24rpx;
            .name {
              width: 60rpx;
              overflow: hidden; /* 确保超出容器的文本被隐藏 */
              white-space: nowrap; /* 防止文本换行 */
              text-overflow: ellipsis;
            }
            .icon {
              width: 80rpx;
              height: 80rpx;
              border-radius: 100%;
              border: 4rpx solid #462917;
            }
          }
        }
      }
      .select_box {
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1;
        top: 20rpx;
        width: 100%;
        image {
          width: 160rpx;
          margin: 0 20rpx;
        }
      }
    }
    .content {
      position: relative;
      width: 600rpx;

      .goldsBox {
        width: 600rpx;
        height: 700rpx;
        background: red;
        position: absolute;
        .goldItem {
          position: absolute;
          z-index: 3;
        }
      }
    }
  }
  .timeBox {
    width: 750rpx;
    position: absolute;
    left: 50%;
    margin-left: -375rpx;
    display: flex;
    justify-content: space-between;
    padding: 0 60rpx;
    box-sizing: border-box;
    top: 30rpx;
    z-index: 2;
    view {
      width: 260rpx;
      height: 60rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 28rpx;
      background: rgba(36, 8, 7, 0.4);
      color: white;
      border-radius: 30rpx;
      border: 4rpx solid #fff;
    }
  }
  @keyframes fadeOut {
    0% {
      /* 动画开始时的样式 */
      opacity: 1;
      transform: translate(0rpx);
    }
    70% {
      transform: scale(4);
      /* 动画结束时的样式 */
      opacity: 1;
    }
    100% {
      /* 动画结束时的样式 */
      opacity: 0;
      transform: translate(280rpx, -200rpx) scale(2);
    }
  }
  .hide {
    animation: fadeOut 3s forwards; /* 应用动画 */
  }
  .point {
    position: absolute;
    z-index: 1000;
    width: 10rpx;
    height: 10rpx;
    background: red;
  }
  .rulepopup-content {
    width: 626rpx;
    height: 900rpx;
    background-image: url('https://ojqn.wm2177.com/wechat_imgs/gold/rule-popup.png'); /* 替换为你的图片路径 */
    background-size: 100%;
    position: relative;
    padding-top: 20rpx;
    box-sizing: border-box;
    .ruleTxt {
      color: #431a0e;
      font-size: 38rpx;
      width: 100%;
      text-align: center;
      font-weight: bold;
      padding: 10rpx 0;
      box-sizing: border-box;
    }
    .content {
      padding: 10rpx 30rpx;
      box-sizing: border-box;
    }
    image {
      width: 48rpx;
      height: 48rpx;
      position: absolute;
      right: 40rpx;
      top: 20rpx;
    }
    // https://ojqn.wm2177.com/wechat_imgs/gold/rule-popup.png
  }
  .logspopup-content {
    width: 611rpx;
    height: 721rpx;
    background-image: url('https://ojqn.wm2177.com/wechat_imgs/gold/logs-popup.png'); /* 替换为你的图片路径 */
    background-size: 100%;
    position: relative;
    .scroll_goods {
      position: absolute;
      width: 500rpx;
      height: 230rpx;
      white-space: nowrap;
      left: 50%;
      margin-left: -250rpx;
      top: 300rpx;
      display: flex;
      align-items: center;
      overflow-x: scroll;
      .goodsItem {
        display: inline-block;
        margin-right: 30rpx;
        width: 190rpx;
        height: 190rpx;
        background-image: url('https://ojqn.wm2177.com/wechat_imgs/gold/goods-bg.png'); /* 替换为你的图片路径 */
        background-size: 100%;
        align-items: center;
        justify-content: center;
        position: relative;
        .timetxt {
          position: absolute;
          bottom: -30rpx;
          font-size: 20rpx;
        }
        image {
          // position: absolute;
          margin: auto;
          margin-top: 40rpx;
          width: 140rpx;
        }
      }
    }
    .sure {
      width: 200rpx;
      height: 80rpx;
      position: absolute;
      left: 50%;
      margin-left: -100rpx;
      bottom: 100rpx;
      //
    }
    .bottomTxt {
      width: 100%;
      text-align: center;
      position: absolute;
      bottom: 60rpx;
      font-size: 22rpx;
      color: #431a0e;
    }
    // https://ojqn.wm2177.com/wechat_imgs/gold/rule-popup.png
  }
  .war-top {
    padding-left: 18rpx;
    position: fixed;
    z-index: 99999;
    top: 88rpx;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    .war-back {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 57rpx;
      height: 57rpx;
      background-color: rgba(7, 1, 53, 0.5);
      border-radius: 50%;

      .back-aim {
        width: 20rpx;
        height: 20rpx;
        border-top: 4rpx solid #fff;
        border-left: 4rpx solid #fff;
        transform: rotate(-45deg);
      }
    }
  }
  .warp {
    width: 750rpx;
    height: 100vh;
    overflow: hidden;
    .top_box {
      position: relative;
      .logs_btn {
        position: absolute;
        width: 190rpx;
        right: 20rpx;
        top: 200rpx;
      }
      .rule_btn {
        position: absolute;
        width: 190rpx;
        right: 20rpx;
        top: 200rpx;
      }
      .gift-box {
        width: 204rpx;
        position: absolute;
        right: 10rpx;
        bottom: 60rpx;
        z-index: 4;
      }
      .topBg {
        width: 750rpx;
      }
    }
    .content {
      position: relative;
      width: 750rpx;
      .moveBox {
        position: absolute;
        width: 80rpx;
        left: 50%;
        margin-left: -40rpx;
        z-index: 2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform-origin: 50% 0;
      }
      .clip {
        display: inline-block;
      }
      .rope {
        background-image: url('https://ojqn.wm2177.com/wechat_imgs/gold/rope.png'); /* 替换为你的图片路径 */
        background-repeat: repeat;
        width: 10rpx;
        z-index: 2;
        display: inline-block;
      }
      .npc {
        width: 250rpx;
        position: absolute;
        left: 50%;
        margin-left: -125rpx;
        z-index: 2;
      }
      .goldsBox {
        width: 750rpx;
        height: 700rpx;
        position: absolute;
        .clipsPoints {
          position: absolute;
          width: 8rpx;
          height: 8rpx;
          background: red;
        }
        .goldItem {
          position: absolute;
          z-index: 3;
        }
      }
    }
  }
  .begin_btn {
    position: fixed;
    width: 160rpx;
    height: 160rpx;
    left: 50%;
    margin-left: -80rpx;
    z-index: 4;
    bottom: 60rpx;
  }
  image {
    display: block;
    vertical-align: bottom; /* 或者使用 top 或 middle，根据需求 */
  }
</style>
